﻿#ifndef PROGRESSDAEMONTHREAD_H
#define PROGRESSDAEMONTHREAD_H

#include <QThread>
#include <daemonlogservice.h>
#include <progressmanage.h>
#include <progressservice.h>
#include <heartbeatmanage.h>
#include <progressinfo.h>
#include <QMutex>

//#include "vld.h"


class ProgressDaemonThread : public QThread
{
    Q_OBJECT
public:
    explicit ProgressDaemonThread(QObject *parent = nullptr);
    ~ProgressDaemonThread();
    void stop();
    void initParam();

    QList<ProgressInfo> getProgressInfoList();

    void setProgressInfoList(const QList<ProgressInfo> &value);

public slots:
    void slot_daemonDipose();
    void slot_progressInfoList(QList<ProgressInfo> list); //进程信息状态包和连接对象总包列表到界面
signals:
    void signal_runStatus(bool status);
private:
    void openInitStartProgress();
    void closeMultiOpenProcess(string &progressPath);
    bool startProgress(string &progressPath);
    void writeLog(int start_type,bool startState,QString progress_name,QString progress_path);
private:
    bool isRun;
    int open_sleep; //启动等待时长
    QMutex progressInfoListMutex;
    QList<ProgressInfo> progressInfoList;

    HeartbeatManage heartbeatManage;
    ProgressManage progressManage;
    DaemonLogService daemonLogService;
protected:
    void run() override;

};

#endif // PROGRESSDAEMONTHREAD_H
